package com.xbongbong.paas.pojo.dto;

import com.alibaba.fastjson.JSONObject;
import com.xbongbong.paas.domain.entity.PaasProcessNodeTaskEntity;
import com.xbongbong.paas.domain.entity.ext.PaasAttachmentEntityExt;
import com.xbongbong.paas.domain.entity.ext.PaasProcessTemplateNodeEntityExt;
import com.xbongbong.paas.enums.DelEnum;
import com.xbongbong.paas.toolbox.wrap.BaseDTO;
import com.xbongbong.paas.toolbox.wrap.QueryIgnore;
import com.xbongbong.pro.formdata.pojo.SaasNeedRedundantAttrPojo;
import com.xbongbong.pro.user.pojo.ReturnUserAndDepartmentPojo;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.ArrayList;
import java.util.List;

/**
 * @author: wufeng
 * @date: 2018/8/22 14:34
 * @desrcption: 流程操作
 */
@Getter
@Setter
@ToString
public class  ProcessNodeTaskUpdateDTO extends BaseDTO {

    private static final long serialVersionUID = -4179907461409756663L;

    /**
     * 应用id
     */
    @NotNull(message = "{dto.msg.processNodeTaskUpdate.appId.NotNull}")
    private Long appId;

    /**
     * 菜单id
     */
    @NotNull(message = "{dto.msg.processNodeTaskUpdate.menuId.NotNull}")
    private Long menuId;

    /**
     * 表单id
     */
    @NotNull(message = "{dto.msg.processNodeTaskUpdate.formId.NotNull}")
    private Long formId;

    /**
     * saas标记
     */
    @NotNull(message = "{dto.msg.processNodeTaskUpdate.saasMark.NotNull}")
    private Integer saasMark;

    /**
     * saas业务类型
     */
    private Integer businessType;

    /**
     * 流程节点任务
     */
    @NotNull(message = "{dto.msg.processNodeTaskUpdate.processNodeTaskId.NotNull}")
    @Getter(onMethod_ = {@QueryIgnore})
    private Long processNodeTaskId;

    /**
     * 流程任务
     */
    @NotNull(message = "{dto.msg.processNodeTaskUpdate.processTaskId.NotNull}")
    @Getter(onMethod_ = {@QueryIgnore})
    private Long processTaskId;
    /**
     * 节点任务类型， （0：未处理：1：提交；2：提交并打印；3：暂存:4：转交:5：回退:6：激活流程:7：结束流程；8：抄送，9：撤回，10：重新提交）
     */
    @NotNull(message = "{dto.msg.processNodeTaskUpdate.taskType.NotNull}")
    @Getter(onMethod_ = {@QueryIgnore})
    private Integer taskType;

    /**
     * 回退节点
     */
    @Getter(onMethod_ = {@QueryIgnore})
    private Long backNodeId;

    /**
     * 转交人用户id
     */
    @Getter(onMethod_ = {@QueryIgnore})
    private String transferUserId;
    /**
     * 激活节点的id
     */
    @Getter(onMethod_ = {@QueryIgnore})
    private Long activationNodeId;

    /**
     * 审批意见
     */
    @Getter(onMethod_ = {@QueryIgnore})
    @Size(max = 500, message = "{dto.msg.processNodeTaskUpdate.opinion.Size}")
    private String opinion;

    /**
     * 当前节点信息，由后台查询并赋值，前端不需要传入
     */
    @Getter(onMethod_ = {@QueryIgnore})
    private PaasProcessTemplateNodeEntityExt processTemplateNode;

    @Getter(onMethod_ = {@QueryIgnore})
    private PaasProcessNodeTaskEntity paasProcessNodeTaskEntity;
    /**
     * 流程信息
     */
    @Getter(onMethod_ = {@QueryIgnore})
    private Integer flowStatus;

    /**
     * 表单数据
     */
    @Getter(onMethod_ = {@QueryIgnore})
    private JSONObject dataList;

    /**
     * 图片
     */
    @Getter(onMethod_ = {@QueryIgnore})
    private List<String> images;

    /**
     * 附件
     */
    @Getter(onMethod_ = {@QueryIgnore})
    private List<PaasAttachmentEntityExt> attachmentList;

    /**
     * 非前端所传字段
     */
    @Getter(onMethod_ = {@QueryIgnore})
    private Long formDataId;

    private String serialNo;

    /**
     * 负责人
     */
    private List<ReturnUserAndDepartmentPojo> ownerId;

    private Long departmentId;

    /**
     * saas所需的特殊传参pojo
     */
    private SaasNeedRedundantAttrPojo saasNeedRedundantAttrPoJo;

    /**
     * 艾特的用户id
     */
    private List<String> atUserIds;

    private Integer del;
    /**
     * 报价单组号（目前仅报价单需要）
     */
    @Getter(onMethod_ = {@QueryIgnore})
    private String groupNumber;
    /**
     * 是否老数据,老数据是1
     */
    private Integer isOldProgressData;

    // 线索转换新建客户时，会传这个线索的id和是否将线索跟进记录带到客户的标识
    private Long clueId;
    private Integer isBringCustomer;

    public ProcessNodeTaskUpdateDTO(){
        images = new ArrayList<>();
        attachmentList = new ArrayList<>();
        opinion = "";
        transferUserId = "";
        backNodeId = 0L;
        activationNodeId = 0L;
        del = DelEnum.NORMAL.getDel();
        saasNeedRedundantAttrPoJo = new SaasNeedRedundantAttrPojo();
    }
}
